<template lang="pug">
  .container.homework__main
    .row.content__head
      .col-sm-3
        h2.side__menu__textbook 课本
        .side__menu__switch.side__menu__switch_teacher(@click.stop="selectBook")
          i.icon_switch_normal
          | 切换
        .side__menu__switch.side__menu__switch_teacher(@click.stop="addBook")
          i.icon_switch_normal
          | 添加
      .col-sm-9
        h2.content__filter__title 内容
          small （共2345个资源）
        .content__filter
          .content__filter__date 2017.9.12-2017.9.12
          .content__filter__order 时间顺序
          .side__menu__switch.side__menu__switch_teacher(@click.stop="addNewWork")
            i.icon_switch_normal
            | 新建
      .col-sm-12
        .split
    .row
      .col-sm-3
        h3.side__menu__dt 高二课本
        ul.side__menu__list
          li
            a(href="") 第11章   坐标平面有理数函数
            ul
              li
                a(href="") 二次函数
              li
                a(href="") 不等式方式
                ul
                  li
                    a(href="") 坐标平面有理数函数
      .col-sm-9
        table.homework__tb
          //-     router-link(to="/student/homework/detail") 查看作业
          tr
            td 作业名称
            td 作业状态
            td 创建时间
            td 操作
          tr(v-for="item in list")
            td {{item.homeworkName}}
            td {{item.homeworkStatus == "0" ? "未开始" : "已开始"}}
            td {{item.startTime || "-"}}
            td 
              span(@click="toDetail(item)") 学情追踪
              span(@click="handleRuse") 复用
              span(@click="handleModifyTime") 开启时间
              span 删除       

        page
</template>
<style lang="scss" scoped>
  .container.homework__main{
    .row.content__head{
      .col-sm-3{
        background-color: #fafafa;
      }
    }
  }
  .homework__tb {
    span {
      margin-right: 30px;
      cursor: pointer;
      color: $teacherMainColor;
    }
  }
  .side__menu__list {
    a {
     color: $teacherMainColor;
    }
  }
  .content__filter__order{
    margin-right: 50px;
  }   
</style>

<script>
import api from 'api/tutorship'
export default {
  data () {
    return {
      list: []
    }
  },
  mounted () {
    api.getList('2', {
      studentid: '120176400199057431',
      from: 0,
      size: 10
    }).then((Response) => {
      const data = Response.data
      this.list = data.data.list
    })
  },
  methods: {
    addBook () {
      this.$store.commit('addLession', true)
    },
    selectBook () {
      this.$store.commit('switchLession', {
        teacher: true
      })
    },
    addNewWork () {
      this.$router.push('/teacher/homework/addNewWork/')
    },
    handleRuse () {
      console.log('resue')
    },
    handleModifyTime () {
      console.log('modifytime')
    },
    toDetail (item) {
      console.log('todetail')
      this.$router.push('/teacher/homework/detail/' + item.homeworkId)
    }
  }
}
</script>
